<?php
/**
 * Created by PhpStorm.
 * User: yiyu
 * Email: smalleasyu@gmail.com
 * Date: 2020-01-21 21:34:50
 * Desc:
 */

namespace app\api\controller;

use app\base\model\system\SystemConfig;

class InitController extends ApiBaseController
{
    protected $beforeActionList = [
        'checkLogin',
        'getSysCurrencyName'
    ];

    public function getInitConfig()
    {

        $data['currency_name'] = $this->currency_name;//货币名称

        $data['tips'] = [
            //帮人达成心愿的tips
            'support_friend_tips' => "帮我达成心愿 · 你可获得<span style='color:#FF0000;'>等额" . $this->currency_name . "</span>",
            //支持成功弹窗的tips
            'support_success_tips' => $this->currency_name . "可免费兑换好物",
            //发起兑换弹窗的tips
            'get_currency_tips' => "支持他人心愿，你得等额" . $this->currency_name,

        ];

        return $this->successReturn($data);

    }

    /**
     * Desc: 判断小程序是否为审核版本
     * Date: 2020/2/26 22:18
     * Author: yiyu
     * @return \think\response\Json
     */
    public function isMiniProgramReviewVersion()
    {
        $is_review_version = version_compare(CLIENT_VERSION, SystemConfig::getSystemConfigByName('mini_program_review_version', ''), '=');

        return $this->successReturn(['is_review' => $is_review_version ? 1 : 0]);
    }
}